#ifndef GRAPHICSBUTTON_H
#define GRAPHICSBUTTON_H

#include <QGraphicsItem>
#include <QObject>

class GraphicsButton : public QObject, public QGraphicsItem
{
	Q_OBJECT
	Q_INTERFACES(QGraphicsItem)

public:
	GraphicsButton( QGraphicsItem *parent = 0);
	GraphicsButton( const QPixmap&, const QPixmap&, QGraphicsItem *parent = 0 );
	~GraphicsButton();
	void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
	QRectF boundingRect() const;
	void setIcon(const QPixmap&);
	QPixmap& getIcon();
signals:
	void triggered();

protected:
	void mousePressEvent ( QGraphicsSceneMouseEvent* );
	void mouseMoveEvent ( QGraphicsSceneMouseEvent *);
	void mouseReleaseEvent( QGraphicsSceneMouseEvent *);

private:
	QPixmap _icon;
	QPixmap _iconAfterPressed;
	bool _isPressed;
};

#endif // GRAPHICSBUTTON_H